package com.ruoyi.web.core.config;

import com.ruoyi.net.constant.UdpConstants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.io.IOException;
import java.net.DatagramSocket;

/**
 * 全局udp配置
 */
@Configuration
public class UdpSocketConfig {
    //udp配置
    @Bean
    @Scope("singleton")
    public DatagramSocket datagramSocket() throws IOException {
        return new DatagramSocket(UdpConstants.UDP_PORT);
    }
}